# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         demo4.27
# Description:  分片赋值
# Author:       $赵怡蕾
# Date:         2019/1/18
#-------------------------------------------------------------------------------

s = ["hello","world","yeah"]
s[1:] = ["a","b","c"]              # 将列表s从第2个元素开始替换成一个新的列表
print(s)                           # 运行结果：['hello', 'a', 'b', 'c']
name = list("Mike")                # 使用list函数将"mike"转换成由字符组成的列表
print(name)                        # 运行结果：['M', 'i', 'k', 'e']
name[1:] = list("ary")             # 利用分片赋值操作将'mike"替换成了"mary"
print(name)                        # 运行结果：['M', 'a', 'r', 'y']
